package com.hashimoto.server.test.runner;

import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import com.hashimoto.core.remote.server.DefaultLoginAuthHandler;
import com.hashimoto.core.remote.server.DefaultReceivedListener;
import com.hashimoto.core.remote.server.NettyServer;

@Component
@Order(99)
public class StartServerRunner implements CommandLineRunner {

	@Override
	public void run(String... args) throws Exception {
		NettyServer server = new NettyServer();
		server.setPort(9999);
		server.setAuthHandler(new DefaultLoginAuthHandler()); //登陆权限校验器,实际按需重新实现 LoginAuthHandler 接口
		server.setListener(new TestReceivedListener());   //ReceivedListener 接收监听器   服务器接收到的消息将会在些监听，按需重新实现ReceivedListener 接口（实现太简陋了，有待完善）
		server.start();  //启动服务

	}

}
